package cn.zzuzhm.mybatis.factory;

import java.io.IOException;

import org.apache.ibatis.session.SqlSession;

import cn.zzuzhm.mybatis.entity.Employee;
import cn.zzuzhm.mybatis.mapper.EmployeeMapper;

public class MybatisTest {

	public static void main(String[] args) {
		
		SqlSession sqlSession = null;
		try {
			sqlSession = DBConnect.getSqlSesssion();
			EmployeeMapper employeeMapper = sqlSession.getMapper(EmployeeMapper.class);
			Employee employee = employeeMapper.getEmployeeById(2);
			System.out.println(employee);
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			if(sqlSession!=null){
				sqlSession.close();
			}
		}
		
	}

}
